package yy.soft.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

@Data
public class ResultInfo<T> extends ResultInfoBase {
    @JsonProperty("Result")
    private T Result;

    public ResultInfo<T> ok (T result){
        this.setSuccess(true);
        this.setResult(result);
        return this;
    }

    public ResultInfo<T> ok (T result,String msg){
        this.setSuccess(true);
        this.setResult(result);
        this.setMsg(msg);
        return this;
    }

    public ResultInfo<T> ok (){
        this.setSuccess(true);
        return this;
    }

    public ResultInfo<T> error(String msg){
        this.setSuccess(false);
        this.setMsg(msg);
        return this;
    }

    public ResultInfo<T> error(String msg,String info){
        this.setSuccess(false);
        this.setMsg(msg);
        this.setInfo(info);
        return this;
    }
}